dgamma(x,shape,rate,···)
two distributional statistics can be estimated using the density
nction named as fitdistr in the MASS library before calling
mma function. The function is a generic one to estimate the
onal statistics for a variety of density functions. Given a vector
by x, the syntax of this function is shown below, where densfun
ameter to specify a density function such as Gaussian or Gamma
fitdistr(x,densfun,···)
tumour area feature of the breast cancer diagnosis data set was
to follow a Gamma distribution, the following code was used to
two distributional statistics (the shape and the rate parameters)
eature, where malignant was generated using the same way as
r the tumour radius
del=fitdistr(malignant,densfun=‘gamma’)
tatistics of this function include the shape and the rate parameters
mma density function. Next, the dgamma function was called to
a Gamma density function for this breast tumour area feature,
model$estimate[1]
odel$estimate[2]
ma(sort(malignant),shape=shape,rate=rate)
e 2.9 shows the resulting densities of the benign tumours and the
t tumours using this method for the tumour area feature of the
ncer data. It can be seen from both plots that each estimated
sing the parametric approach fits the raw density estimated using
gram approach very well. This shows that if the density format is
n advance, the parametric approach is a good alternative to
a density function for a data set. The major advantage of the